package ThreadPool.lagou.concurrent.demo03;

/**
 * @param
 * @author oyz
 * @version 1.0.4
 * @description: 生产者线程
 * @date 2022/5/24 20:56
 */
public class ProducerThread extends Thread {

    private MyQueue myQueue;

    public ProducerThread (MyQueue myQueue){
        this.myQueue = myQueue;
    }

    private int index = 0;


    @Override
    public void run() {
        while(true){
            try {
                String str = "生产者生产数据"+index;
                myQueue.put(str);
                System.out.println(str);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            index++;
        }

    }
}
